<template>
  <div>
    <detail-banner :gallary='gallary' :sightName="sightName" :bannerImg="bannerImg"></detail-banner>
    <detail-header></detail-header>
    <div class="content">
      <detail-list :list='list'></detail-list>
    </div>
  </div>
</template>

<script>
import DetailBanner from './components/DetailBanner'
import DetailHeader from './components/DetailHeader'
import DetailList from './components/DetailList'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      list: [],
      gallary: [],
      sightName: '',
      bannerImg: ''
      // lastDetail: false
    }
  },
  mounted () {
    this.getDetailInfo()
    this.lastDetail = true
  },
  // activated () {
  //   if (this.lastDetail) {
  //     this.getDetailInfo()
  //   }
  // },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json').then(this.getDetailInfoSucc)
    },
    getDetailInfoSucc (res) {
      res = res.data
      if (res.data && res.ret) {
        const data = res.data
        this.list = data.categoryList
        this.gallary = data.gallaryImgs
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
 .content
  height 50rem
</style>
